/*测试入库
* */
var stockInDAO = require('../dao/stock_in');
var stockInDetailDAO = require('../dao/stock_in_detail');

function testStock_in(){

     var stock_in = {
         user_id:2,
         in_type:'退货入库',
         in_date:'2021-10-9',
         details:[
             {
                 product_id:1,
                 quantity:300
             },{
                 product_id:2,
                 quantity:50
             }
         ]
     }

     stockInDAO.insert(stock_in,function (result) {
         for(var i=0;i<stock_in.details.length;i++)
         {
             stock_in.details[i].stock_in_id = result.insertId;
             stockInDetailDAO.insert(stock_in.details[i],function (result) {
                 console.log(result.insertId);
             })
         }

     })

}


testStock_in();